package com.guchenbo.example.dubbo.template;

import java.util.List;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.cluster.Directory;
import org.apache.dubbo.rpc.cluster.RouterFactory;

public abstract class DirectoryTemplate<T> implements Directory<T> {

  private URL url;
  private RouterFactory routerFactory;

  public DirectoryTemplate(URL url) {
    this.url = url;
  }

  @Override
  public List<Invoker<T>> list(Invocation invocation) throws RpcException {
    return doList(invocation);
  }

  protected abstract List<Invoker<T>> doList(Invocation invocation);

  @Override
  public URL getUrl() {
    return url;
  }

  @Override
  public boolean isAvailable() {
    return false;
  }

  @Override
  public void destroy() {

  }

}
